package com.example.UI;

import android.os.Bundle;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.example.UI.entity.User;
import com.example.ui.R;


public class StudentActivity extends AppCompatActivity {

    private TextView tvStudentId;
    private TextView tvName;
    private TextView tvClassName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_student);

        tvStudentId = findViewById(R.id.tv_student_id);
        tvName = findViewById(R.id.tv_name);
        tvClassName = findViewById(R.id.tv_class_name);
        // ... 省略其他 TextView 初始化代码 ...

        // 从 Intent 中获取 User 对象并更新界面
        User user = getIntent().getParcelableExtra("user");
        if (user != null) {
            updateTextViews(user);
        }
    }

    private void updateTextViews(User user) {
        tvStudentId.setText("学号: " + user.getStudent_id());
        tvName.setText("姓名: " + user.getName());
        tvClassName.setText("班级: " + user.getClass_name());
        // ... 省略其他 TextView 更新代码 ...
    }
}
